package com.mmy.service.plane.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mmy.dao.plane.TPlanePlanRepository;
import com.mmy.dao.plane.VPlanePlanRepository;
import com.mmy.domain.plane.TPlanePlan;
import com.mmy.domain.plane.VPlanePlan;
import com.mmy.service.plane.TPlanePlanService;

@Service
public class TPlanePlanServiceImpl implements TPlanePlanService {

	@Autowired
	TPlanePlanRepository tPlanePlanRepository;
	@Autowired
	VPlanePlanRepository vPlanePlanRepository;

	/**
	 * 查找全部
	 * 
	 * @param
	 * @return
	 */
	public List<VPlanePlan> findAll() {
		// TODO Auto-generated method stub
		return vPlanePlanRepository.findAll();
	}

	/**
	 * 获取计划单最大编码
	 * 
	 * @return 返回值说明 计划单编码
	 * @author 创建人 dingxd
	 * @date 创建日期 2020.11.16
	 */
	public String getMaxPlanID() {
		// 返回计划单最大编码
		Object objCode = tPlanePlanRepository.getMaxPlanID();
		String strPlanID = "";
		if (objCode != null) {
			strPlanID = objCode.toString();
		}
		return strPlanID;
	}

	/**
	 * 新增id
	 * 
	 * @param
	 * @return
	 */
	public void save(int planID) {
		// TODO Auto-generated method stub
		tPlanePlanRepository.save(planID);
	}

	/**
	 * 新增
	 * 
	 * @param
	 * @return
	 */
	public void save(TPlanePlan tPlanePlan) {
		// TODO Auto-generated method stub
		tPlanePlanRepository.save(tPlanePlan);
	}

	/**
	 * 删除
	 * 
	 * @param
	 * @return
	 */
	public void delPlanePlan(List<Integer> lstPlanID) {
		// TODO Auto-generated method stub
		tPlanePlanRepository.delPlanePlan(lstPlanID);
	}

	/**
	 * 通过id查找
	 * 
	 * @param
	 * @return
	 */
	public TPlanePlan findByPlanID(int iPlanID) {
		// TODO Auto-generated method stub
		return tPlanePlanRepository.findByPlanID(iPlanID);
	}

	/**
	 * 通过name查找
	 * 
	 * @param
	 * @return
	 */
	public List<VPlanePlan> findByName(String strPlaneName) {
		// TODO Auto-generated method stub
		return vPlanePlanRepository.findByName(strPlaneName);
	}

	/**
	 * 通过id查找
	 * 
	 * @param
	 * @return
	 */
	public VPlanePlan findByID(int iPlanID) {
		// TODO Auto-generated method stub
		return vPlanePlanRepository.findByPlanID(iPlanID);
	}

	/**
	 * 通过id查找
	 * 
	 * @param
	 * @return
	 */
	public List<VPlanePlan> findByPlaneID(int iPlaneID) {
		// TODO Auto-generated method stub
		return vPlanePlanRepository.findByPlaneID(iPlaneID);
	}

}
